package log

import (
	nested "github.com/antonfisher/nested-logrus-formatter"
	"github.com/sirupsen/logrus"
	"os"
	"time"
)

var log = logrus.New()

func init() {
	// 设置format json
	log.SetReportCaller(true)
	log.SetFormatter(&nested.Formatter{
		// HideKeys:        true,
		TimestampFormat: time.RFC3339,
	})
	// 设置输出警告级别
	log.SetLevel(logrus.DebugLevel)
	// 输出位置
	log.SetOutput(os.Stdout)
	//logfile, _ := os.OpenFile("./logrus.log", os.O_CREATE|os.O_RDWR|os.O_APPEND, 0644)
	//logrus.SetOutput(logfile)
}

func Logger() *logrus.Logger {
	return log
}
